package com.sa.commons.aop.intercepter;

import java.lang.reflect.Method;

import org.springframework.aop.ThrowsAdvice;

/**
 * 异常拦截器，处理传入数据异常如需要传入的数据为int型却没有传入数据
 * @author 黄欣i
 
 * 
 * ThrowsInterceptor
 */
public class ThrowsInterceptor implements ThrowsAdvice {
	// 异常拦截器
	public void afterThrowing(Method method, Object[] args, Object instance, RuntimeException ex) throws Throwable {
		System.out.println("方法" + method.getName() + " 抛出了异常：" + ex);
	}

	public void afterThrowing(NullPointerException ex) throws Throwable {
		System.out.println("抛出了异常：" + ex);
	}
}
